import axios from 'axios';

// 获取商品表单头
let goods_header = (params) => axios.get('/product/product/type_header', { params });

// 商品列表
let goods_list = (params) => axios.get('/product/product', { params });

// 商品上下架操作
let goods_set_show = (id, is_show, data) => axios.put(`/product/product/set_show/${id}/${is_show}`, data);

// 保存新增或编辑
let set_goods = (id, data) => axios.post(`/product/product/${id}`, data);

// 商品采集
let goods_garther = (data) => axios.post('/product/copy', data);

// 批量设置
let bath_setting = (data) => axios.post('/product/batch/setting', data);

// 获取规则属性模板
let get_goods_rule = (params) => axios.get('/product/product/get_rule', { params });

// 获取运费模板
let get_template = (params) => axios.get('/product/product/get_template', { params });

// 设置商品批量下架
let batch_product_unshow = (data) => axios.put('/product/product/product_unshow', data);

// 设置产品批量上架
let batch_product_show = (data) => axios.put('/product/product/product_show', data);

// 选择商品列表
let product_list = (params) => axios.get('/product/product/list', { params });

// 商品详情
let product_detail = (id, params) => axios.get(`/product/product/${id}`, { params });

// 商品加入/移除回收站
let recycle_bin = (id, params) => axios.delete(`/product/product/${id}`, { params });

export default {
    goods_header,
    goods_list,
    goods_set_show,
    set_goods,
    goods_garther,
    bath_setting,
    get_goods_rule,
    get_template,
    batch_product_unshow,
    batch_product_show,
    product_list,
    product_detail,
    recycle_bin,
}